import { v4 as uuidv4 } from 'uuid';
// uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'

export function getUserTempId(){
  // 唯一 不轻易改变   uuid
  // 先从localStorage当中获取这个uuid
  let userTempId = localStorage.getItem('userTempId_key')
  // 如果有，那就直接返回使用
  // 如果没有，那么就uuid创建，并且存储localStorage
  if(!userTempId){
    userTempId = uuidv4()
    localStorage.setItem('userTempId_key',userTempId)
  }
  

  return userTempId
}